SCREEN_H = 2560
SCREEN_W = 1440

INTERESTED_PERMISSIONS = [
    'ACCEPT_HANDOVER',
    'ACCESS_BACKGROUND_LOCATION',
    'ACCESS_CALL_AUDIO',
    'ACCESS_CHECKIN_PROPERTIES',
    'ACCESS_COARSE_LOCATION',
    'ACCESS_FINE_LOCATION',
    'ACCESS_LOCATION_EXTRA_COMMANDS',
    'ACCESS_MEDIA_LOCATION',
    'ACCESS_NETWORK_STATE',
    'ACCESS_NOTIFICATION_POLICY',
    'ACCESS_WIFI_STATE',
    'ACCOUNT_MANAGER',
    'ACTIVITY_RECOGNITION',
    'ADD_VOICEMAIL',
    'ANSWER_PHONE_CALLS',
    'BATTERY_STATS',
    'BIND_ACCESSIBILITY_SERVICE',
    'BIND_APPWIDGET',
    'BIND_AUTOFILL_SERVICE',
    'BIND_CALL_REDIRECTION_SERVICE',
    'BIND_CARRIER_MESSAGING_CLIENT_SERVICE',
    'BIND_CARRIER_MESSAGING_SERVICE',
    'BIND_CARRIER_SERVICES',
    'BIND_CHOOSER_TARGET_SERVICE',
    'BIND_CONDITION_PROVIDER_SERVICE',
    'BIND_CONTROLS',
    'BIND_DEVICE_ADMIN',
    'BIND_DREAM_SERVICE',
    'BIND_INCALL_SERVICE',
    'BIND_INPUT_METHOD',
    'BIND_MIDI_DEVICE_SERVICE',
    'BIND_NFC_SERVICE',
    'BIND_NOTIFICATION_LISTENER_SERVICE',
    'BIND_PRINT_SERVICE',
    'BIND_QUICK_ACCESS_WALLET_SERVICE',
    'BIND_QUICK_SETTINGS_TILE',
    'BIND_REMOTEVIEWS',
    'BIND_SCREENING_SERVICE',
    'BIND_TELECOM_CONNECTION_SERVICE',
    'BIND_TEXT_SERVICE',
    'BIND_TV_INPUT',
    'BIND_VISUAL_VOICEMAIL_SERVICE',
    'BIND_VOICE_INTERACTION',
    'BIND_VPN_SERVICE',
    'BIND_VR_LISTENER_SERVICE',
    'BIND_WALLPAPER',
    'BLUETOOTH',
    'BLUETOOTH_ADMIN',
    'BLUETOOTH_PRIVILEGED',
    'BODY_SENSORS',
    'BROADCAST_PACKAGE_REMOVED',
    'BROADCAST_SMS',
    'BROADCAST_STICKY',
    'BROADCAST_WAP_PUSH',
    'CALL_COMPANION_APP',
    'CALL_PHONE',
    'CALL_PRIVILEGED',
    'CAMERA',
    'CAPTURE_AUDIO_OUTPUT',
    'CHANGE_COMPONENT_ENABLED_STATE',
    'CHANGE_CONFIGURATION',
    'CHANGE_NETWORK_STATE',
    'CHANGE_WIFI_MULTICAST_STATE'
]


INTERESTED_BROADCASTS = [
    'AIRPLANE_MODE_CHANGED',
    'BATTERY_CHANGED',
    'BATTERY_LOW',
    'BATTERY_OKAY',
    'BOOT_COMPLETED',
    'DATE_CHANGED',
    'DEVICE_STORAGE_LOW',
    'DEVICE_STORAGE_OK',
    'INPUT_METHOD_CHANGED',
    'INSTALL_PACKAGE',
    'LOCALE_CHANGED',
    'MEDIA_EJECT',
    'MEDIA_MOUNTED',
    'MEDIA_REMOVED',
    'MEDIA_SHARED',
    'MEDIA_UNMOUNTED',
    'NEW_OUTGOING_CALL',
    'OPEN_DOCUMENT',
    'OPEN_DOCUMENT_TREE',
    'PACKAGE_ADDED',
    'PACKAGE_CHANGED',
    'PACKAGE_DATA_CLEARED',
    'PACKAGE_FIRST_LAUNCH',
    'PACKAGE_FULLY_REMOVED',
    'PACKAGE_INSTALL',
    'PACKAGE_REMOVED',
    'PACKAGE_REPLACED',
    'PACKAGE_RESTARTED',
    'PACKAGE_VERIFIED',
    'PASTE',
    'POWER_CONNECTED',
    'POWER_DISCONNECTED',
    'POWER_USAGE_SUMMARY',
    'PROVIDER_CHANGED',
    'QUICK_CLOCK',
    'REBOOT',
    'SCREEN_OFF',
    'SCREEN_ON',
    'SET_WALLPAPER',
    'SHUTDOWN',
    'TIMEZONE_CHANGED',
    'TIME_CHANGED',
    'TIME_TICK',
    'UID_REMOVED',
    'UNINSTALL_PACKAGE',
    'USER_BACKGROUND',
    'USER_FOREGROUND',
    'USER_INITIALIZE',
    'USER_PRESENT',
    'VOICE_COMMAND',
    'WALLPAPER_CHANGED',
    'WEB_SEARCH'
]

# TODO @Songhe please define this list
# A list of APIs to monitor at runtime
# Note that this list is used to represent the app's behavior
INTERESTED_APIS = [
    'android.webkit.WebView.saveWebArchive',
    'android.content.Context.fileList',
    'java.util.Hashtable.keys',
    'android.text.format.toMillis',
    'java.lang.Process.destroy',
    'java.util.concurrent.getActiveCount',
    'android.webkit.WebChromeClient.onRequestFocus',
    'android.net.wifi.saveConfiguration',
    'android.net.wifi.isWifiEnabled',
    'java.util.zip.$init',
    'android.telephony.cdma.getBaseStationId',
    'android.app.Dialog.dispatchKeyEvent',
    'java.net.SocketException.printStackTrace',
    'java.util.zip.finish',
    'android.text.Editable.toString',
    'java.lang.Process.getInputStream',
    'android.text.format.$init',
    'java.security.InvalidAlgorithmParameterException.printStackTrace',
    'android.net.wifi.getConnectionInfo',
    'java.lang.ClassLoader.getParent',
    'java.io.BufferedWriter.close',
    'java.lang.Character.$init',
    'android.content.ContextWrapper.sendOrderedBroadcast',
    'android.view.Window.setIcon',
    'android.content.pm.$init',
    'javax.crypto.KeyGenerator.generateKey',
    'java.util.jar.putValue',
    'android.content.ContextWrapper.createPackageContext',
    'java.security.DigestInputStream.$init',
    'java.io.LineNumberReader.readLine',
    'android.widget.EditText.setFocusable',
    'android.app.Instrumentation.callActivityOnSaveInstanceState',
    'android.accounts.AccountManager.updateCredentials',
    'java.nio.charset.isOverflow',
    'android.net.wifi.disableNetwork',
    'javax.crypto.Cipher.getInstance',
    'org.w3c.dom.getElementsByTagName',
    'java.net.URL.openConnection',
    'android.app.Instrumentation.callActivityOnPostCreate',
    'android.webkit.WebSettings.setMinimumFontSize',
    'java.lang.ProcessBuilder.start',
    'java.security.DigestInputStream.read',
    'java.io.BufferedWriter.write',
    'java.util.zip.setCompressedSize',
    'java.util.jar.putAll',
    'android.telephony.gsm.getLac',
    'android.content.res.setToDefaults',
    'android.net.ConnectivityManager.getActiveNetworkInfo',
    'java.util.jar.getName',
    'javax.crypto.EncryptedPrivateKeyInfo.getKeySpec',
    'org.xmlpull.v1.setFeature',
    'android.widget.LinearLayout.setBackgroundDrawable',
    'android.net.NetworkInfo.getExtraInfo',
    'android.content.pm.getPackageArchiveInfo',
    'android.widget.CheckBox.getTextColors',
    'java.net.URLClassLoader.$init',
    'android.app.Application.onCreate',
    'android.view.Window.getLayoutInflater',
    'java.net.Proxy.$init',
    'android.app.AlertDialog.$init',
    'android.database.sqlite.isOpen',
    'android.widget.RadioButton.setOnCheckedChangeListener',
    'android.webkit.WebView.loadData',
    'javax.crypto.SecretKeyFactory.generateSecret',
    'android.app.Instrumentation.onException',
    'java.security.cert.printStackTrace',
    'android.content.ContentResolver.delete',
    'java.net.URL.getDefaultPort',
    'android.app.Service.onStartCommand',
    'android.webkit.WebView.getVisibility',
    'java.util.WeakHashMap.size',
    'android.net.wifi.updateNetwork',
    'android.webkit.WebView.removeAllViews',
    'android.app.Service.onConfigurationChanged',
    'java.security.SecureRandom.setSeed',
    'java.util.concurrent.done',
    'java.net.URL.openStream',
    'javax.crypto.CipherOutputStream.write',
    'java.security.DigestInputStream.getMessageDigest',
    'java.util.jar.read',
    'android.app.Instrumentation.callActivityOnNewIntent',
    'java.net.URLConnection.setDoInput',
    'android.widget.EditText.setTextSize',
    'java.util.zip.finished',
    'java.math.BigInteger.divideAndRemainder',
    'android.net.wifi.enableNetwork',
    'android.app.Instrumentation.callActivityOnStart',
    'android.webkit.WebView.setTag',
    'android.net.Proxy.getDefaultHost',
    'java.io.Reader.markSupported',
    'android.app.Instrumentation.callActivityOnUserLeaving',
    'java.util.WeakHashMap.keySet',
    'org.apache.http.setStaleCheckingEnabled',
    'android.telephony.cdma.getSystemId',
    'javax.crypto.Mac.getAlgorithm',
    'android.location.LocationManager.setTestProviderEnabled',
    'android.webkit.WebSettings.getMinimumFontSize',
    'java.text.DateFormat.getInstance',
    'android.content.ContextWrapper.sendBroadcastAsUser',
    'java.util.zip.getValue',
    'java.text.SimpleDateFormat.applyPattern',
    'java.util.zip.flush',
    'java.security.InvalidKeyException.printStackTrace',
    'java.lang.Runtime.String")',
    'java.net.URLClassLoader.loadClass',
    'java.lang.StringBuffer.substring',
    'java.lang.ProcessBuilder.redirectErrorStream',
    'java.nio.charset.$init',
    'java.security.spec.$init',
    'dalvik.system.DexClassLoader.findLibrary',
    'android.location.LocationManager.getCurrentLocation',
    'android.text.format.set',
    'android.net.wifi.getScanResults',
    'android.app.Dialog.setOnKeyListener',
    'java.io.ByteArrayOutputStream.reset',
    'android.app.AlertDialog.onCreate',
    'javax.crypto.CipherOutputStream.flush',
    'android.app.Application.$init',
    'android.telephony.cdma.getNetworkId',
    'java.io.LineNumberReader.$init',
    'android.telephony.cdma.getBaseStationLongitude',
    'org.xmlpull.v1.text',
    'org.apache.http.printStackTrace',
    'javax.crypto.CipherOutputStream.close',
    'java.net.NetworkInterface.getInetAddresses',
    'java.lang.Process.getOutputStream',
    'java.util.Properties.store',
    'android.app.Service.onStart',
    'java.io.FileWriter.close',
    'android.net.Proxy.getDefaultPort',
    'javax.crypto.SecretKeyFactory.getInstance',
    'android.webkit.CookieManager.removeAllCookie',
    'android.content.ContextWrapper.removeStickyBroadcast',
    'android.widget.Toast.cancel',
    'java.net.URLConnection.getHeaderField',
    'java.security.cert.getPublicKey',
    'android.net.wifi.setWifiEnabled',
    'org.apache.http.setIntParameter',
    'java.io.BufferedReader.ready',
    'android.telephony.gsm.getCid',
    'android.net.NetworkInfo.isAvailable',
    'java.lang.Character.toTitleCase',
    'javax.crypto.Cipher.getBlockSize',
    'java.util.jar.entries',
    'java.util.zip.update',
    'javax.crypto.spec.$init',
    'android.webkit.WebView.setDownloadListener',
    'android.widget.EditText.setFocusableInTouchMode',
    'java.util.Date.toLocaleString',
    'java.util.concurrent.getTaskCount',
    'java.net.NetworkInterface.getDisplayName',
    'java.lang.StringBuffer.ensureCapacity',
    'java.util.jar.close',
    'java.io.FileReader.read',
    'android.widget.EditText.setGravity',
    'android.telephony.TelephonyManager.getLine1Number',
    'android.app.Instrumentation.callActivityOnRestoreInstanceState',
    'java.nio.charset.isError',
    'java.io.StringReader.close',
    'java.io.OutputStreamWriter.close',
    'java.nio.charset.toString',
    'java.lang.Integer.byteValue',
    'android.content.IntentFilter.setPriority',
    'android.content.ContextWrapper.sendStickyOrderedBroadcastAsUser',
    'android.util.Base64.encode',
    'javax.net.ssl.setDefaultHostnameVerifier',
    'android.webkit.WebSettings.setDefaultZoom',
    'android.content.ContextWrapper.sendStickyOrderedBroadcast',
    'android.graphics.drawable.$init',
    'android.widget.EditText.getContext',
    'android.content.ContextWrapper.sendOrderedBroadcastAsUser',
    'android.widget.RadioButton.isChecked',
    'java.util.zip.reset',
    'android.net.SSLCertificateSocketFactory.getHttpSocketFactory',
    'java.io.OutputStreamWriter.flush',
    'android.net.wifi.getConfiguredNetworks',
    'android.telephony.cdma.getBaseStationLatitude',
    'java.text.SimpleDateFormat.applyLocalizedPattern',
    'android.view.Window.setLogo',
    'java.security.Security.setProperty',
    'java.net.NetworkInterface.getByName',
    'android.content.ContextWrapper.sendStickyBroadcast',
    'java.io.UnsupportedEncodingException.initCause',
    'java.util.Properties.put',
    'java.io.BufferedInputStream.mark',
    'org.xmlpull.v1.nextText',
    'android.webkit.WebView.setVerticalScrollbarOverlay',
    'android.os.HandlerThread.isAlive',
    'java.io.BufferedInputStream.reset',
    'android.app.Application.attachBaseContext',
    'android.bluetooth.BluetoothAdapter.getAddress',
    'android.hardware.Sensor.getName',
    'android.app.Service.onLowMemory',
    'java.net.SocketTimeoutException.printStackTrace',
    'android.webkit.WebView.removeJavascriptInterface',
    'android.os.Bundle.getClassLoader',
    'android.app.Application.getDir',
    'android.hardware.Sensor.getVersion',
    'javax.crypto.KeyGenerator.getInstance',
    'java.lang.Process.waitFor',
    'android.content.ContextWrapper.sendStickyBroadcastAsUser',
    'javax.crypto.BadPaddingException.printStackTrace',
    'android.webkit.WebSettings.setTextSize',
    'android.view.animation.start',
    'android.graphics.NinePatch.isNinePatchChunk',
    'java.util.concurrent.getCompletedTaskCount',
    'android.net.ConnectivityManager.startUsingNetworkFeature',
    'android.widget.LinearLayout.setMinimumWidth',
    'java.nio.channels.lock',
    'android.content.ContextWrapper.sendBroadcast',
    'java.io.LineNumberReader.close',
    'javax.crypto.KeyGenerator.init',
    'java.nio.channels.release',
    'android.net.wifi.disconnect',
    'java.io.DataInputStream.readLine',
    'java.util.jar.$init',
    'java.lang.ProcessBuilder.$init',
    'java.security.MessageDigest.getInstance',
    'android.net.ConnectivityManager.getAllNetworkInfo',
    'android.hardware.Sensor.getVendor'
]

# TODO @Songhe please define this list
# A list of sensitive APIs
# Note that this list is used to identify sensitive behaviors in the app
SENSITIVE_APIS = [
    'android.telephony.SubscriptionManager.addOnSubscriptionsChangedListener',
    'android.net.sip.open',
    'android.telephony.SmsManager.divideMessage',
    'android.accounts.AccountManager.getAccounts',
    'android.widget.QuickContactBadge.assignContactFromPhone',
    'android.telephony.TelephonyManager.getDeviceSoftwareVersion',
    'android.accounts.AccountManager.editProperties',
    'android.telecom.TelecomManager.isInCall',
    'android.app.ActivityManager.getRunningAppProcesses',
    'android.speech.SpeechRecognizer.startListening',
    'android.provider.Browser.addSearchUrl',
    'android.location.LocationManager.addNmeaListener',
    'android.telephony.TelephonyManager.getCellLocation',
    'android.app.KeyguardManager.exitKeyguardSecurely',
    'android.accounts.AccountManager.hasFeatures',
    'android.net.sip.unregister',
    'android.content.pm.setComponentEnabledSetting',
    'android.net.sip.takeAudioCall',
    'app.admin.DevicePolicyManager.isAdminActive',
    'android.accounts.AccountManager.removeAccount',
    'android.location.LocationManager.addGpsStatusListener',
    'android.app.DownloadManager.enqueue',
    'android.media.MediaRecorder.setVideoSource',
    'android.telephony.gsm.sendDataMessage',
    'android.speech.SpeechRecognizer.cancel',
    'android.telephony.SubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex',
    'app.admin.DevicePolicyManager.lockNow',
    'app.admin.DevicePolicyManager.resetPassword',
    'android.accounts.AccountManager.getAccountsByType',
    'android.accounts.AccountManager.addAccount',
    'android.app.DownloadManager.getUriForDownloadedFile',
    'android.location.LocationManager.addProximityAlert',
    'android.provider.Browser.deleteFromHistory',
    'android.telephony.TelephonyManager.getVoiceMailAlphaTag',
    'android.accounts.AccountManager.confirmCredentials',
    'android.content.ContentResolver.query',
    'android.app.ActivityManager.killBackgroundProcesses',
    'android.app.ActivityManager.restartPackage',
    'android.inputmethodservice.KeyboardView.swipeRight',
    'android.telephony.TelephonyManager.getNeighboringCellInfo',
    'android.speech.SpeechRecognizer.stopListening',
    'android.app.DownloadManager.addCompletedDownload',
    'android.accounts.AccountManager.getAuthToken',
    'android.provider.Browser.clearHistory',
    'android.location.LocationManager.getProvider',
    'android.telephony.SmsManager.sendDataMessage',
    'android.speech.SpeechRecognizer.setRecognitionListener',
    'android.telephony.TelephonyManager.getDeviceId',
    'android.content.BroadcastReceiver.abortBroadcast',
    'android.provider.Browser.deleteHistoryTimeFrame',
    'android.app.ApplicationPackageManager.getInstalledPackages',
    'android.accounts.AccountManager.getAccountsByTypeAndFeatures',
    'android.provider.Browser.updateVisitedHistory',
    'android.telephony.SubscriptionManager.getActiveSubscriptionInfoList',
    'android.net.sip.makeAudioCall',
    'android.net.sip.setRegistrationListener',
    'android.telephony.SmsManager.sendTextMessage',
    'android.net.sip.register',
    'android.telephony.TelephonyManager.getGroupIdLevel1',
    'android.telephony.SubscriptionManager.getActiveSubscriptionInfoCount',
    'android.telephony.SubscriptionManager.getActiveSubscriptionInfo',
    'android.provider.Browser.clearSearches',
    'android.telephony.gsm.sendMultipartTextMessage',
    'android.telephony.TelephonyManager.getSimSerialNumber',
    'android.app.ApplicationPackageManager.installPackage',
    'android.hardware.Camera.open',
    'android.telephony.SmsManager.downloadMultimediaMessage',
    'android.telephony.TelephonyManager.getSubscriberId',
    'android.accounts.AccountManager.blockingGetAuthToken',
    'android.telephony.SmsManager.sendMultipartTextMessage',
    'android.telephony.SmsManager.sendMultimediaMessage',
    'android.inputmethodservice.KeyboardView.swipeDown',
    'android.telephony.PhoneNumberUtils.isVoiceMailNumber',
    'android.telephony.TelephonyManager.listen',
    'android.provider.Browser.truncateHistory',
    'android.app.ActivityManager.forceStopPackage',
    'android.location.LocationManager.requestSingleUpdate',
    'android.telephony.TelephonyManager.getAllCellInfo',
    'android.telephony.TelephonyManager.getVoiceMailNumber',
    'android.location.LocationManager.getBestProvider',
    'android.media.MediaRecorder.setAudioSource',
    'android.widget.QuickContactBadge.assignContactFromEmail',
    'android.location.LocationManager.requestLocationUpdates',
    'android.app.ApplicationPackageManager.getInstalledApplications',
    'android.accounts.AccountManager.addOnAccountsUpdatedListener',
    'android.app.ApplicationPackageManager.deletePackage',
    'android.net.sip.isOpened',
    'android.net.sip.getSessionFor',
    'android.net.sip.createSipSession',
    'android.location.LocationManager.getLastKnownLocation',
    'android.widget.QuickContactBadge.onClick',
    'android.location.LocationManager.isProviderEnabled',
    'android.net.sip.isRegistered',
    'android.telephony.gsm.divideMessage',
    'android.view.inputmethod.showInputMethodAndSubtypeEnabler',
    'android.net.sip.close',
    'android.telecom.TelecomManager.showInCallScreen',
    'android.app.ApplicationPackageManager.setComponentEnabledSetting',
    'android.location.LocationManager.getProviders',
]

ACTION_TYPES = [
    'gesture',
    'intent',
    'key'
]

GESTURE_TYPES = [
    'touch',
    'long_touch',
    'scroll_up',
    'scroll_down'
]

